//
//  ZHFPlayListCell.m
//  GoTraveling
//
//  Created by dllo on 15/12/28.
//  Copyright © 2015年 开发华佗. All rights reserved.
//

#import "ZHFPlayListCell.h"

#import "UIView_extra.h"

@implementation ZHFPlayListCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return self;
}

- (void)createSubView{
    self.title = [[UILabel alloc]initWithFrame:CGRectMake(self.frame.size.width / 20, self.frame.size.height / 10 * 3, self.frame.size.width / 3 * 2, self.frame.size.height / 3)];
    self.title.backgroundColor = [UIColor whiteColor];
    self.title.font = [UIFont systemFontOfSize:self.frame.size.height / 3];
    self.title.textColor = [UIColor colorWithRed:50/255.0 green:50/255.0 blue:50/255.0 alpha:1.0];
    [self.contentView addSubview:self.title];
    
    self.author = [[UILabel alloc]initWithFrame:CGRectMake(self.frame.size.width / 20, self.frame.size.height / 10 * 7, self.frame.size.width / 3 * 2, self.frame.size.height / 3)];
    self.author.font = [UIFont systemFontOfSize:self.frame.size.height / 4];
    self.author.textColor = [UIColor colorWithRed:100/255.0 green:100/255.0 blue:100/255.0 alpha:1.0];
    [self.contentView addSubview:self.author];
    
}


-(void)setPlayListModel:(ZHFListPlayList *)playListModel{
    
    self.title.text = playListModel.title;
    BOOL result = [[[NSUserDefaults standardUserDefaults]objectForKey:@"HomePush"] isEqualToString:@"1"];
    if (result) {
        self.author.text = [NSString stringWithFormat:@"%@",[playListModel.userinfo objectForKey:@"uname"]];
    }else{
        self.author.text = [NSString stringWithFormat:@"%@",[[playListModel.playInfo objectForKey:@"userinfo"] objectForKey:@"uname"]];
    }
    [self.title sizeToFit];
    self.author.origin = CGPointMake(self.frame.size.width / 20, self.frame.size.height / 10 * 7);
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
